<template>
  <div class="course-container">

    <div>
      <TopicCourse :currentTab="currentTab"></TopicCourse>
    </div>

  </div>
</template>

<script>
import BaseCourse from "../components/course/BaseCourse";
import TopicCourse from "../components/course/TopicCourse";

export default {
  //组件名称
  name: "Course",
  //组件注册
  components: {
    BaseCourse,
    TopicCourse
  },
  //数据驱动
  data() {
    return {
      topicList: [],
      currentTab: 0
    }
  },
  //计算属性
  computed: {},
  //数据监听
  watch: {},
  //方法
  methods: {
    //查询主题分类
    selectTopicList() {
      this.axios.get("/course/web/topic/list")
          .then((data) => {
            this.topicList = data.data
          })
    }
  },
  //钩子函数
  created() {
    this.selectTopicList();
    this.currentTab = this.$store.getters.getCurrentTopic
    this.$router.replace({
      "hash": this.currentTab
    })
  },
}
</script>

<style lang="less" scoped>
.course-container {
  background-color: #EFEFEF;
  padding-top: 10px;

  a {
    display: inline-block;
    text-decoration: none;
    color: #515a6e;
  }
}
</style>